package com.safety.apitest.source;

import com.safety.apitest.beans.SensorReading;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import sun.management.Sensor;

import java.util.Arrays;

/**
 * @Author: QingW
 * @Date: 2021/9/17
 */
public class SourceTest1_Collection {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);
        DataStreamSource<SensorReading> dataStreamSource = env.fromCollection(Arrays.asList(new SensorReading("sensor_1", 1631762486597L, 39.6),
                new SensorReading("sensor_3", 1621762486597L, 39.6),
                new SensorReading("sensor_5", 1611762486597L, 39.6),
                new SensorReading("sensor_7", 160762486597L, 39.6)
        ));

        DataStreamSource<Integer> integerDataStreamSource = env.fromElements(1, 3, 5, 7, 9);

        dataStreamSource.print("data");
        integerDataStreamSource.print("Int");
        env.execute("Wang-Create-Job");
    }


}
